package com.redoor.app.stake.basicdata.hsf.service.impl;

import com.alibaba.boot.hsf.annotation.HSFProvider;
import com.redoor.app.stake.basicdata.service.BaseEquipmentInfoService;
import com.yotouch.app.stake.Consts;
import com.yotouch.app.stake.hsf.qz.QzEquipmentService;
import com.yotouch.app.stake.model.Equipment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * HSF设备型号信息实现
 * Created by zhangYiHang on 2018/3/27.
 */
@HSFProvider(serviceInterface = QzEquipmentService.class, serviceVersion = "5.0.0", serviceGroup = "grp_asset_of_stake", clientTimeout = 600000)
@Service
public class QzEquipmentServiceImpl implements QzEquipmentService{

    private static final Logger logger = LoggerFactory.getLogger(QzEquipmentServiceImpl.class);

    @Autowired
    private BaseEquipmentInfoService baseEquipmentInfoService;


    @Override
    public List<Equipment> queryEquipmentByVendorUuid(String vendorUuid) {

        logger.info("前置根据厂家主键："+vendorUuid+" 查询设备型号信息开始");

        if (vendorUuid == null || vendorUuid.trim().length()==0){
            logger.info("厂家主键不能为空!");
            return null;
        }
        List<Equipment> equipments = null;
        try{
            Map<String,Object> map = new HashMap<String,Object>(2);
            map.put("vendorUuid", vendorUuid);
            map.put("status", Consts.STATUS_NORMAL);
            equipments = this.baseEquipmentInfoService.qryEquipmentInfoToHSF(map);
        }catch (Exception e){
            e.printStackTrace();
        }

        logger.info("前置根据厂家主键："+vendorUuid+" 查询设备型号信息结束");

        return equipments;
    }
}
